package gold.contest;

import gold.utils.InputUtil;

import java.util.*;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC5268 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public List<List<Integer>> findDifference(int[] nums1, int[] nums2) {
            List<List<Integer>> ans = new ArrayList<>();
            Set<Integer> s1 = new HashSet<Integer>(), s2 = new HashSet<>();
            for (int n : nums1) s1.add(n);
            for (int n : nums2) s2.add(n);

            List<Integer> an1 = new ArrayList<>(), an2 = new ArrayList<>();
            for (Integer n1 : s1) {
                if (!s2.contains(n1)) an1.add(n1);
            }

            for (Integer n2 : s2) {
                if (!s1.contains(n2)) an2.add(n2);
            }

            ans.add(an1);
            ans.add(an2);
            return ans;
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.findDifference(InputUtil.toIntegerArray("[1,2,3,3]"), InputUtil.toIntegerArray("[1,1,2,2]")));
    }

    public static void main(String[] args) throws Exception {
        LC5268 an = new LC5268();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
